//
//  HealthReportsCell.m
//  Ginix
//
//  Created by fzq on 2025/2/17.
//

#import "HealthReportsCell.h"

@interface HealthReportsCell()
@property (nonatomic,strong) UIView * bgView;
@property (nonatomic,strong) UILabel * nameLabel;
@property (nonatomic,strong) UIImageView * arrow;

@end

@implementation HealthReportsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        self.backgroundColor = UIColor.clearColor;
        self.contentView.backgroundColor = UIColor.clearColor;
        [self setSubViewLayout];
    }
    return self;
}
-(void)setSubViewLayout{
    
    [self addSubview:self.bgView];
    [_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@0);
        make.bottom.mas_offset(-10 * FMScaleX);
        make.left.mas_offset(20 * FMScaleX);
        make.right.mas_offset(-20 * FMScaleX);
    }];
    
    [self.bgView addSubview:self.arrow];
    [_arrow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15 * FMScaleX);
        make.top.mas_offset(18 * FMScaleX);
        make.size.mas_offset(CGSizeMake(24  * FMScaleX, 24 * FMScaleX));

    }];
    
    [self.bgView addSubview:self.nameLabel];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15 * FMScaleX);
        make.top.mas_offset(18 * FMScaleX);
        make.right.equalTo(self.arrow.mas_left).offset(-10 * FMScaleX);
        make.height.mas_offset(24 * FMScaleX);
    }];
}

-(void)setInfoModel:(HealthListModel *)infoModel type:(NSInteger)type{
    
    
    if (type == 0) {
        self.nameLabel.text = [NSString stringWithFormat:@"%@ 快速身体检测报告",infoModel.createTime];
    }else{
        self.nameLabel.text = [NSString stringWithFormat:@"%@ 全面身体检测报告",infoModel.createTime];
    }
}

-(UIView *)bgView{
    
    if(!_bgView){
        _bgView = [[UIView alloc]init];
        _bgView.backgroundColor = UIColor.whiteColor;
        [_bgView setCornerRadius:4 * FMScaleX];
    }
    return _bgView;
}

-(UILabel *)nameLabel{
    
    if(!_nameLabel){
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.text = @"2025-06-04 17:24 全面身体检测报告";
        _nameLabel.font = Regular(15);
        _nameLabel.textColor = RDRGB(0x555555);
    }
    return _nameLabel;
}

-(UIImageView *)arrow{
    
    if(!_arrow){
        _arrow = [[UIImageView alloc]init];
        _arrow.image = [UIImage imageNamed:@"Me_set_arrow"];
    }
    return _arrow;
}
@end
